MV_CC_GetAllMatchInfo

MV_CC_GetAllMatchInfo

Get the information of all types.

API Definition

int MV_CC_GetAllMatchInfo(
  void                 *handle,
  MV_ALL_MATCH_INFO    *pstInfo
);

Parameters

handle

[IN] Device handle, which is returned by MV_CC_CreateHandle or MV_CC_CreateHandleWithoutLog.

pstInfo

[IN] [OUT] Information structure, see MV_ALL_MATCH_INFO for details.

Return Value

Return MV_OK(0) on success, and return Error Code on failure.

Remarks

  • Input required information type (specify nType in structure MV_ALL_MATCH_INFO) in the API and get corresponding information (return in pInfo of structure MV_ALL_MATCH_INFO).

  • The calling precondition of this API is determined by obtained information type. Call after enabling capture to get MV_MATCH_TYPE_NET_DETECT information of GigE device, and call after starting device to get MV_MATCH_TYPE_USB_DETECT information of USB3Vision device.

  • This API is not supported by CameraLink device.

The following sample code is for reference only.

#include "MvCameraControl.h"

void main()
{
    int nRet = -1;
    void* m_handle = NULL;

    //Enumerate all devices corresponding to specified transport protocol within subnet
    unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
    MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
    int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
    if (MV_OK != nRet)
    {
        printf("error: EnumDevices fail [%x]\n", nRet);
        return;
    }

    int i = 0;
    if (m_stDevList.nDeviceNum == 0)
    {
        printf("no camera found!\n");
        return;
    }

    //Select the first found online device and create device handle
    int nDeviceIndex = 0;

    MV_CC_DEVICE_INFO m_stDevInfo = {0};
    memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));

    nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);

    if (MV_OK != nRet)
    {
        printf("error: CreateHandle fail [%x]\n", nRet);
        return;
    }

    else
    {
        unsigned int nAccessMode = MV_ACCESS_Exclusive;
        unsigned short nSwitchoverKey = 0;

        //Connect device
        nRet = MV_CC_OpenDevice(m_handle, nAccessMode, nSwitchoverKey);
        if (MV_OK != nRet)
        {
            printf("error: OpenDevice fail [%x]\n", nRet);
            return;
        }            
    }

    //...other processing

    //Start acquiring images
    nRet = MV_CC_StartGrabbing(m_handle);
    if (MV_OK != nRet)
    {
         printf("error: StartGrabbing fail [%x]\n", nRet);
        return;
    }

    Sleep(5000);

    //Get camera network data flow and packet loss information
    MV_ALL_MATCH_INFO struMatchInfo = {0};
    MV_MATCH_INFO_NET_DETECT stMatchInfoNetDetect;
    struMatchInfo.pInfo = &stMatchInfoNetDetect;

    struMatchInfo.nType = MV_MATCH_TYPE_NET_DETECT;
    memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_NET_DETECT));
    struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_NET_DETECT);

    nRet = MV_CC_GetAllMatchInfo(m_handle, &struMatchInfo);
    if (MV_OK != nRet)
    {
        printf("error: GetAllMatchInfo fail [%x]\n", nRet);
        return;
    }

    //...other processing

    //Stop acquiring images
    nRet = MV_CC_StopGrabbing(m_handle);
    if (MV_OK != nRet)
    {
        OutputString(_T("Operation: Stop Grabbing......failed!"));
        return;
    }

    //Shut device and release resource
    nRet = MV_CC_CloseDevice(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: CloseDevice fail [%x]\n", nRet);
        return;
    }

    //Destroy handle and release resource
    nRet = MV_CC_DestroyHandle(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: DestroyHandle fail [%x]\n", nRet);
        return;
    }
}

MV_CC_GetAllMatchInfo

Get the information of all types.

API Definition

int MV_CC_GetAllMatchInfo(
  void                 *handle,
  MV_ALL_MATCH_INFO    *pstInfo
);

Parameters

handle

[IN] Device handle, which is returned by MV_CC_CreateHandle or MV_CC_CreateHandleWithoutLog.

pstInfo

[IN] [OUT] Information structure, see MV_ALL_MATCH_INFO for details.

Return Value

Return MV_OK(0) on success, and return Error Code on failure.

Remarks

  • Input required information type (specify nType in structure MV_ALL_MATCH_INFO) in the API and get corresponding information (return in pInfo of structure MV_ALL_MATCH_INFO).

  • The calling precondition of this API is determined by obtained information type. Call after enabling capture to get MV_MATCH_TYPE_NET_DETECT information of GigE device, and call after starting device to get MV_MATCH_TYPE_USB_DETECT information of USB3Vision device.

  • This API is not supported by CameraLink device.

The following sample code is for reference only.

#include "MvCameraControl.h"

void main()
{
    int nRet = -1;
    void* m_handle = NULL;

    //Enumerate all devices corresponding to specified transport protocol within subnet
    unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
    MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
    int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
    if (MV_OK != nRet)
    {
        printf("error: EnumDevices fail [%x]\n", nRet);
        return;
    }

    int i = 0;
    if (m_stDevList.nDeviceNum == 0)
    {
        printf("no camera found!\n");
        return;
    }

    //Select the first found online device and create device handle
    int nDeviceIndex = 0;

    MV_CC_DEVICE_INFO m_stDevInfo = {0};
    memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));

    nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);

    if (MV_OK != nRet)
    {
        printf("error: CreateHandle fail [%x]\n", nRet);
        return;
    }

    else
    {
        unsigned int nAccessMode = MV_ACCESS_Exclusive;
        unsigned short nSwitchoverKey = 0;

        //Connect device
        nRet = MV_CC_OpenDevice(m_handle, nAccessMode, nSwitchoverKey);
        if (MV_OK != nRet)
        {
            printf("error: OpenDevice fail [%x]\n", nRet);
            return;
        }            
    }

    //...other processing

    //Start acquiring images
    nRet = MV_CC_StartGrabbing(m_handle);
    if (MV_OK != nRet)
    {
         printf("error: StartGrabbing fail [%x]\n", nRet);
        return;
    }

    Sleep(5000);

    //Get camera network data flow and packet loss information
    MV_ALL_MATCH_INFO struMatchInfo = {0};
    MV_MATCH_INFO_NET_DETECT stMatchInfoNetDetect;
    struMatchInfo.pInfo = &stMatchInfoNetDetect;

    struMatchInfo.nType = MV_MATCH_TYPE_NET_DETECT;
    memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_NET_DETECT));
    struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_NET_DETECT);

    nRet = MV_CC_GetAllMatchInfo(m_handle, &struMatchInfo);
    if (MV_OK != nRet)
    {
        printf("error: GetAllMatchInfo fail [%x]\n", nRet);
        return;
    }

    //...other processing

    //Stop acquiring images
    nRet = MV_CC_StopGrabbing(m_handle);
    if (MV_OK != nRet)
    {
        OutputString(_T("Operation: Stop Grabbing......failed!"));
        return;
    }

    //Shut device and release resource
    nRet = MV_CC_CloseDevice(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: CloseDevice fail [%x]\n", nRet);
        return;
    }

    //Destroy handle and release resource
    nRet = MV_CC_DestroyHandle(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: DestroyHandle fail [%x]\n", nRet);
        return;
    }
}